package com.wd.mine.adapter

import android.content.Context
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Button
import android.widget.ImageView
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import com.bumptech.glide.Glide
import com.wd.common.bean.FollowBean
import com.wd.mine.R

/**
 * Created by Android Studio.
 * author: 张文龙
 * Date:
 * Time: 2023/9/14 20:00
 * 备注：
 */
class FollowAdapter(private var  context: Context,private var list:ArrayList<FollowBean.Result>) : RecyclerView.Adapter<FollowAdapter.Holder>(){

    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): Holder {
        val inflate = LayoutInflater.from(context).inflate(R.layout.me_follow_item, parent, false)
        return Holder(inflate)
    }

    override fun getItemCount() = list.size

    override fun onBindViewHolder(holder: Holder, position: Int) {
        val result = list[position]
        Glide.with(context)
            .load(R.mipmap.ic_launcher_round)
            .circleCrop()
            .into(holder.follow_pic)
        holder.follow_name.text = result.nickName

    }
    class Holder(itemView: View) : RecyclerView.ViewHolder(itemView){
        val follow_pic : ImageView
        val follow_name : TextView
        val follow_push_t : TextView
        val follow_fans : TextView
        val follow_btn : Button
        init {
            follow_pic = itemView.findViewById(R.id.me_follow_img)
            follow_name = itemView.findViewById(R.id.me_follow_name)
            follow_push_t = itemView.findViewById(R.id.push_t)
            follow_fans = itemView.findViewById(R.id.fans)
            follow_btn = itemView.findViewById(R.id.follow_tic)
        }

    }
}